# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gobject-introspection
pkgver=1.78.1
pkgrel=0
pkgdesc="Introspection system for GObject-based libraries"
url="https://wiki.gnome.org/action/show/Projects/GObjectIntrospection"
arch="all"
license="LGPL-2.0-or-later AND GPL-2.0-or-later AND MIT"
depends_dev="python3 cairo-dev libtool"
makedepends="$depends_dev glib-dev libffi-dev flex bison python3-dev meson"
subpackages="$pkgname-doc $pkgname-dev"
replaces="libgirepository"
checkdepends="sed"
source="https://download.gnome.org/sources/gobject-introspection/${pkgver%.*}/gobject-introspection-$pkgver.tar.xz
	musl-time64.patch
	"

case "$CARCH" in
*)
	# FIXME: the gir scan on
	#define REGRESS_GOOD_EXPR_CONSTANT (1 + 2 * (3 + 2) << 3 - 4 >> REGRESS_ATEST_ERROR_CODE2)
	# evaluates to 0 instead of -2305843009213693952
	# so a test failes
	# https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/458
	options="$options !check"
	;;
esac

build() {
	abuild-meson -Db_lto=true . output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

dev() {
	amove usr/bin usr/share usr/lib/gobject-introspection
	default_dev
	replaces="gobject-introspection"
}

sha512sums="
a3081882995a762645b04faa71082dbd523bee845519007e48b13235aad8a4cd4c74f0d042a6c17710125f945bd970e4b76e95a559274e294d595e04725a4e97  gobject-introspection-1.78.1.tar.xz
965649f0c50e5d6e424a765685533f4dcc776ade3b917e1d960242edbcb5c52f5c98556a1032b9515173b0c30a076964caeece3431b943029e1e3d2552136e77  musl-time64.patch
"
